package com.project.mapper;

import com.project.bean.ManBean;
import com.project.util.ManUtil;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

public interface IManMapper {
    @Insert("insert into t_man(m_name,m_birthday) values(#{name},#{birthday})")
    public void add(ManBean man);

    @Delete("delete from t_man where pk_manId=#{id}")
    public void del(int id);

    @Update("update t_man set m_birthday=#{birthday} where pk_manId=#{id}")
    public void update(@Param("id") int id,@Param("birthday") LocalDate birthday);

    public ManBean findById(int id);

    @Select("select * from t_man")
    @ResultMap("manMap")
    public List<ManBean> findAll();

    /**
     * 动态条件查询
     * @param map 条件map
     * @return  公民集合
     */
    @SelectProvider(type = ManUtil.class,method = "findByItem")
    @ResultMap("manMap")
    public List<ManBean> findByItem(Map map);
}
